This app was quickly written as an enhancement to the RECEDIT example (found in the VB Samples directory) to explore the benefits of using the Random File Access facilities available in native Visual Basic.
These appear to provide facilities which are particulary pertinent for:
a) small data files in the region of up to say 5000 records if partial matching searches are required (as in the 'Find Surname' procedure in this app) or
b) much larger files (up to 2 billion records) if you would be content with finding records simply by using the record number as the primary key or
c) small floppy disk data file storage (try creating a file 'Open File' on the floppy disk in drive A: and populating it with a 1000 records using the 'Create Random Data' button. Test the speed of access by navigating through the floppy disk data file. Then try doing the same using Access!)
Advantages:
1 - No additional DLL / VBX / OCX required
2 - Small .EXE footprint
3 - Speed of operation
4 - Speed of access
5 - Easily maintained
Disadvantages:
1 - Lack of support for dynamic indexes
2 - Fixed length records (redundant disk space)
The speed of access is quite refreshing when compaired to equivalent Jet Table access.
I also took this opportunity to share some ideas concerning structured Visual Basic Coding practices which embrace the following:
a) Variable naming standard
b) Control naming standard
c) Avoiding absolute references to Controls eg: txtData(n)
d) Using the Tag property instead
e) Using Windows API functions (setting tabs in a listbox, changing Control Box Menus)
f) Retrieving data from listboxes
g) Creating User Defined Data Types
to name a few.
Hope you find a worthwhile application for Random File Access and the code in this app. If you do, perhaps you could return the favour and let us know of your successes.